import mockRequest from '@/utils/mockRequest'
import { reqDataList } from '@/api/echarts'
import {set } from 'nprogress'
const state = {
    countlist: [],
    gamenamelist1: [],
    gamenamelist2: [],
    avggradelist: []

}
const mutations = {
    GETCOUNTLIST(state, countlist) {
        state.countlist = countlist
    },
    GETGAMENAMELIST1(state, gamenamelist1) {
        state.gamenamelist1 = gamenamelist1;
    },
    GETGAMENAMELIST2(state, gamenamelist2) {
        state.gamenamelist2 = gamenamelist2;
    },
    GETAVGGRADELIST(state, avggradelist) {
        state.avggradelist = avggradelist;
    }
}
const actions = {
    async getCountList({ commit }) {
        let res = await reqDataList()
        if (res.code == 200) {
            commit('GETCOUNTLIST', res.countlist)
        }
    },
    async getGamenameList1({ commit }) {
        let res = await reqDataList()
        if (res.code == 200) {
            commit('GETGAMENAMELIST1', res.gamenamelist1)
        }
    },
    async getGamenameList2({ commit }) {
        let res = await reqDataList()
        if (res.code == 200) {
            commit('GETGAMENAMELIST2', res.gamenamelist2)
        }
    },
    async getAvgGradeList({ commit }) {
        let res = await reqDataList()
        if (res.code == 200) {

            commit('GETAVGGRADELIST', res.avggradelist)
        }
    },

}

const getters = {}
export default {
    state,
    actions,
    mutations,
    getters
}